﻿using System.ServiceProcess;
using Sustainalytics.Common.Hosting;
using Sustainalytics.ProductInvolvement.Service.Infrastructure;

namespace Sustainalytics.ProductInvolvement.Service
{
    public partial class ProductInvolvementService : ServiceBase
    {
        ProductInvolvementApplication application;
        public ProductInvolvementService()
        {
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            application = new ProductInvolvementApplication(new BasicEventLogLogger("Sustainalytics.ProductInvolvementApplication.Service"));
            application.Start();
        }

        protected override void OnStop()
        {
            try
            {
                application.Dispose();
            }
            catch
            {
                EventLog.WriteEntry("");
            }
        }
    }
}
